package com.seirsoft.product.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectProvider {
	private ConnectProvider()
	{
		
	}
	
	public static ConnectProvider getInstance()
	{
		return new ConnectProvider();
	}
	
	private String getDriverClassName()
	{
		return "org.apache.derby.jdbc.EmbeddedDriver";
	}
	
	private String getConnectString()
	{
		return "jdbc:derby:TESTDB;create=true";
	}
	
	public Connection getConnection() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
	{
	  	 Class.forName(getDriverClassName()).newInstance();			//加载驱动
         return  DriverManager.getConnection(getConnectString());	//连接数据库
	}
}
